﻿using Microsoft.AspNetCore.Mvc;
using SportsPlatform.Query.ClientLog;
using SportsPlatform.Application.SportBusiness.ISportBusiness;
using SportsPlatform.Base;
using SportsPlatform.Filters;
using System.Threading.Tasks;
using SportsPlatform.Application.Dto.ClientLog;
using SportsPlatform.Application.Query.ClientLog;
using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;

namespace SportsPlatform.Controllers
{
    /// <summary>
    /// 客户端日志记录控制器
    /// </summary>
    [ActionAuthorization]
    [Route("api/[controller]/[action]")]
    public class ClientLogController : SportsPlatformControllerBase
    {
        private IClientLogService _service;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="service"></param>
        public ClientLogController(IClientLogService service)
        {
            _service = service;
        }

        /// <summary>
        /// 新增客户端操作日志
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<BaseResultDto> AddClientLog([FromBody] List<AddClientLogQuery> query)
        {
            return await _service.AddClientLog(query);
        }

        /// <summary>
        /// 分页获取客户端日志操作记录
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagePagingDto<GetClientLogPageListDto>> GetClientLogPageList([FromBody] GetClientLogPageListQuery query)
        {
            return await _service.GetClientLogPageList(query);
        }

    }
}
